package com.zxd.singleton;

/**
 * ClassName:Lazy
 * Package:com.zxd.singleton
 *
 * @Date:2023/9/21 10:44
 * @Author:zxde
 */

/**
 * 懒汉单例模式，只有在别人调用getInstance的时候才会创建对象
 */
public class Lazy {
    private static Lazy lazy;
    private Lazy(){}

    public static Lazy getInstance(){
        if (lazy == null){
            lazy = new Lazy();
        }
        return lazy;
    }
}
